﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace TestConsoleApp
{
    public class TestResetEvent
    {
        private static ManualResetEvent manualResetEvent = new ManualResetEvent(true);


        private static AutoResetEvent autoResetEvent = new AutoResetEvent(false);


        public static void Test()
        {
            int[] sdfsdf = new int[10];



            Task.Run((Action)delegate
            {

                while (true)
                {

                    autoResetEvent.WaitOne();

                    Console.WriteLine("task1---date:" + DateTime.Now.ToString("mm:ss.fff"));

                }
            });


            Task.Run((Action)delegate
            {

                while (true)
                {

                    autoResetEvent.WaitOne();

                    Console.WriteLine("task2---date:" + DateTime.Now.ToString("mm:ss.fff"));

                }
            });


            autoResetEvent.Set();
        }
    }
}
